cmake_minimum_required(VERSION 3.23)
project(CppTest-OpenGL)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_C_STANDARD 17)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")

include_directories(glad/include)

function(add_opengl_executable target)
#    message(STATUS "ARGC=${ARGC}")
#    message(STATUS "ARGV=${ARGV}")
#    message(STATUS "ARGN=${ARGN}")
    add_executable(${target} ${ARGN})
    target_sources(${target} PRIVATE WglContext.cpp WglContext.h glad/src/glad.c)
    target_link_libraries(${target} PRIVATE opengl32.lib)
endfunction()

add_opengl_executable(OpenGLQueue OpenGLQueue.cpp)
add_opengl_executable(OpenGLLock.cpp OpenGLLock.cpp)

